﻿using System.Configuration;

namespace ERP.Framework.Components.ConfigurationHelper.CustomSettings
{
    /// <summary>
    /// Represent ExceptionHandlerSettings section in config file
    /// </summary>
    public sealed class ExceptionHandlerSettings : ConfigurationSection
    {
        #region Properties

        /// <summary>
        /// Gets the settings.
        /// </summary>
        /// <value>The settings.</value>
        internal static ExceptionHandlerSettings Settings
        {
            get
            {
                return System.Configuration.ConfigurationManager.GetSection("ExceptionHandlerSettings") as ExceptionHandlerSettings;
            }
        }

        /// <summary>
        /// Gets the type of the error log.
        /// </summary>
        /// <value>The type of the error log.</value>
        [ConfigurationProperty("ErrorLogType", DefaultValue = "0", IsRequired = true)]
        public int ErrorLogType
        {
            get
            {
                return int.Parse(this["ErrorLogType"].ToString());
            }
        }

        /// <summary>
        /// Gets the error log file path.
        /// </summary>
        /// <value>The error log file path.</value>
        [ConfigurationProperty("ErrorLogFilePath", DefaultValue = @"c:\Log\ErrorLog.xml", IsRequired = true)]
        public string ErrorLogFilePath
        {
            get
            {
                return this["ErrorLogFilePath"].ToString();
            }
        }

        /// <summary>
        /// Gets the name of the error log.
        /// </summary>
        /// <value>The name of the error log.</value>
        [ConfigurationProperty("ErrorLogName", DefaultValue = "ERP", IsRequired = true)]
        public string ErrorLogName
        {
            get
            {
                return this["ErrorLogName"].ToString();
            }
        }

        #endregion
    }
}
